<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>多功能表单界面</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        body {
            background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }
        
        .container {
            width: 100%;
            max-width: 600px;
            background: rgba(255, 255, 255, 0.9);
            border-radius: 16px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            overflow: hidden;
        }
        
        .header {
            background: #4a6fc0;
            color: white;
            padding: 25px 30px;
            text-align: center;
        }
        
        .header h1 {
            font-weight: 600;
            font-size: 28px;
            margin-bottom: 5px;
        }
        
        .header p {
            opacity: 0.9;
        }
        
        .form-body {
            padding: 30px;
        }
        
        .form-group {
            margin-bottom: 25px;
        }
        
        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #2c3e50;
            font-size: 16px;
        }
        
        .form-control {
            width: 100%;
            padding: 14px 16px;
            border: 2px solid #ddd;
            border-radius: 8px;
            font-size: 16px;
            transition: all 0.3s;
        }
        
        .form-control:focus {
            border-color: #4a6fc0;
            box-shadow: 0 0 0 3px rgba(74, 111, 192, 0.2);
            outline: none;
        }
        
        .checkbox-group {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 12px;
            margin-top: 10px;
        }
        
        .checkbox-item {
            display: flex;
            align-items: center;
        }
        
        .checkbox-item input {
            margin-right: 10px;
            width: 18px;
            height: 18px;
        }
        
        .btn {
            background: #4a6fc0;
            color: white;
            border: none;
            padding: 15px 25px;
            font-size: 18px;
            border-radius: 8px;
            cursor: pointer;
            width: 100%;
            font-weight: 600;
            transition: all 0.3s;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .btn:hover {
            background: #3b5aa6;
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }
        
        .btn i {
            margin-right: 10px;
        }
        
        .form-footer {
            text-align: center;
            margin-top: 20px;
            color: #7f8c8d;
            font-size: 14px;
        }
        
        .form-footer a {
            color: #4a6fc0;
            text-decoration: none;
        }
        
        .error {
            color: #e74c3c;
            font-size: 14px;
            margin-top: 5px;
            display: none;
        }
        
        @media (max-width: 768px) {
            .container {
                margin: 10px;
            }
            
            .checkbox-group {
                grid-template-columns: 1fr;
            }
        }
        
        .success-message {
            background: #2ecc71;
            color: white;
            padding: 15px;
            border-radius: 8px;
            text-align: center;
            margin-top: 20px;
            display: none;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1><i class="fas fa-envelope-open-text"></i> 订阅我们的服务</h1>
            <p>填写以下表单以获取最新更新和优惠</p>
        </div>
        
        <div class="form-body">
            <form id="subscriptionForm">
                <div class="form-group">
                    <label for="email"><i class="fas fa-envelope"></i> 邮箱地址</label>
                    <input type="email" id="email" class="form-control" placeholder="请输入有效的邮箱地址" required>
                    <div class="error" id="emailError">请输入有效的邮箱地址</div>
                </div>
                
                <div class="form-group">
                    <label><i class="fas fa-check-square"></i> 选择您感兴趣的内容（多选）</label>
                    <div class="checkbox-group">
                        <div class="checkbox-item">
                            <input type="checkbox" id="news" name="interests" value="news">
                            <label for="news">最新资讯</label>
                        </div>
                        <div class="checkbox-item">
                            <input type="checkbox" id="tutorials" name="interests" value="tutorials">
                            <label for="tutorials">教程文章</label>
                        </div>
                        <div class="checkbox-item">
                            <input type="checkbox" id="offers" name="interests" value="offers">
                            <label for="offers">特别优惠</label>
                        </div>
                        <div class="checkbox-item">
                            <input type="checkbox" id="events" name="interests" value="events">
                            <label for="events">活动通知</label>
                        </div>
                        <div class="checkbox-item">
                            <input type="checkbox" id="webinars" name="interests" value="webinars">
                            <label for="webinars">在线研讨会</label>
                        </div>
                        <div class="checkbox-item">
                            <input type="checkbox" id="updates" name="interests" value="updates">
                            <label for="updates">产品更新</label>
                        </div>
                    </div>
                    <div class="error" id="checkboxError">请至少选择一项您感兴趣的内容</div>
                </div>
                
                <div class="form-group">
                    <label for="frequency"><i class="fas fa-calendar-alt"></i> 接收频率</label>
                    <select id="frequency" class="form-control">
                        <option value="daily">每日更新</option>
                        <option value="weekly" selected>每周摘要</option>
                        <option value="monthly">每月简报</option>
                    </select>
                </div>
                
                <button type="submit" class="btn"><i class="fas fa-paper-plane"></i> 提交订阅</button>
            </form>
            
            <div class="success-message" id="successMessage">
                <i class="fas fa-check-circle"></i> 感谢您的订阅！我们将很快与您联系。
            </div>
            
            <div class="form-footer">
                <p>点击"提交订阅"即表示您同意我们的 <a href="#">服务条款</a> 和 <a href="#">隐私政策</a></p>
            </div>
        </div>
    </div>

    <script>
        document.getElementById('subscriptionForm').addEventListener('submit', function(e) {
            e.preventDefault();
            
            // 邮箱验证
            const email = document.getElementById('email').value;
            const emailError = document.getElementById('emailError');
            const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
            
            if (!emailRegex.test(email)) {
                emailError.style.display = 'block';
                return;
            } else {
                emailError.style.display = 'none';
            }
            
            // 多选验证
            const checkboxes = document.querySelectorAll('input[name="interests"]:checked');
            const checkboxError = document.getElementById('checkboxError');
            
            if (checkboxes.length === 0) {
                checkboxError.style.display = 'block';
                return;
            } else {
                checkboxError.style.display = 'none';
            }
            
            // 如果验证通过，显示成功消息
            document.getElementById('successMessage').style.display = 'block';
            
            // 3秒后重置表单
            setTimeout(function() {
                document.getElementById('subscriptionForm').reset();
                document.getElementById('successMessage').style.display = 'none';
            }, 3000);
        });
    </script>
</body>
</html>